﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ch_elist.aspx.cs" Inherits="manage_channel_CreatLabel_ch_elist" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>创建标签</title>
<link href="../../../sysImages/<% Response.Write(NetCMS.Config.UIConfig.CssPath()); %>/css/css.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript" src="../../../configuration/js/Prototype.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../configuration/js/Public.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../configuration/js/jsPublic.js"></script>
<script type="text/javascript" src="../../../editor/fckeditor.js"></script>
<style type="text/css">
</style>
</head>
<body>
 <form id="ListLabel" runat="server">
    <div style="padding:2px 5px;">
    <table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" class="table">
      <tr class="TR_BG_list">
        <td align="right" class="navi_link" style="width:105px">选择类型</td>
        <td>
        <asp:DropDownList ID="Type" runat="server" Width="100px">
            <asp:ListItem Value="info">信息</asp:ListItem>
            <asp:ListItem Value="special">专题</asp:ListItem>
        </asp:DropDownList>
        </td>
       </tr>      
       <tr class="TR_BG_list">
        <td align="right" class="navi_link" style="width:105px">引用样式</td>
        <td>
        <asp:DropDownList ID="StyleID" runat="server" Width="180px" onchange="showSty(this.value);">
            <asp:ListItem Value="0">固定样式</asp:ListItem>
            <asp:ListItem Value="1">自定义样式</asp:ListItem>
        </asp:DropDownList>
        <span id="TrStyleID">
        <asp:DropDownList ID="gstyleID" runat="server">
        </asp:DropDownList>
        </span>
        </td>
       </tr>
       
       <tr class="TR_BG_list" id="TrstContent" style="display:none;">
       <td align="right">
            自定义样式
            <div style="height:3px;margin:2px 0 4px 0;"></div>
            <input name="saveStyled" value="保存样式" type="button" onclick="ShowStyle();" />
            <div id="showOther" style="display:none;">
            <div style="height:3px;border-bottom:1px dotted #999999;margin:2px 0 4px 0;"></div>
            <asp:TextBox ID="StyleName" Width="94px" runat="server"></asp:TextBox>
            <div style="height:3px;border-bottom:1px dotted #999999;margin:2px 0 4px 0;"></div>
            <asp:DropDownList ID="StyleClassID"  Width="100px" runat="server">
            </asp:DropDownList>
            <div style="height:3px;border-bottom:1px dotted #999999;margin:2px 0 4px 0;"></div>
            <input name="saveStyle" id="saveStyle" value="保存" type="button" onclick="savePostStyle();" />
            <div id="sResultHTML" class="reshow"></div>
            </div>
       </td>
        <td   class="navi_link">
        <asp:DropDownList ID="ChannelStyle" runat="server" onchange="getValue(this.value);">
        <asp:ListItem Value="">01.选择字段</asp:ListItem>
        </asp:DropDownList>
        <label id="style_base" runat="server" />
        <label id="style_class" runat="server" />
        <label id="style_special" runat="server" /> 
        <br />                
<%--        <script type="text/javascript" language="JavaScript">
         window.onload = function()
            {
            var sBasePath = "../../../editor/"
            var oFCKeditor = new FCKeditor('UserDefined') ;
            oFCKeditor.BasePath	= sBasePath ;
            oFCKeditor.Width = '100%' ;
            oFCKeditor.ToolbarSet = 'NT_Basicstyle';
            oFCKeditor.Height = '120px' ;	
            oFCKeditor.ReplaceTextarea() ;
            }
        </script>--%>
        <textarea rows="8" cols="80" name="UserDefined" id="UserDefined" ></textarea>
        <script language="javascript" type="text/javascript">
        function ShowStyle()
        {
            if(document.getElementById("showOther").style.display=="none")
            {
               document.getElementById("showOther").style.display="";
            }
        }
        function savePostStyle()
        {
            var saveStyle= document.getElementById("saveStyle");
            var sname=document.getElementById("StyleName");
            var StyleClassID=document.getElementById("StyleClassID");
            if(sname.value=="")
            {
                alert('请填写样式名称');
                sname.focus();
                return false;
            }
            if(StyleClassID.value=="")
            {
                alert('请选择分类，如果没有分类，请在样式中创建');
                return false;
            }
            //var olEditor = FCKeditorAPI.GetInstance("UserDefined");
            var gtemproot = document.getElementById("UserDefined").value;
            
            var url="SaveStyle.aspx"
            var actionstr="StyleName="+escape(sname.value)+"&ClassID="+escape(StyleClassID.value)+"&Content="+escape(gtemproot)+"&ChID=<%Response.Write(Request.QueryString["ChID"]); %>";
            var divID = "sResultHTML";
            pubPostajax(url,actionstr,divID)
        }
        </script> 
       </td>
       </tr>
       <tr class="TR_BG_list">
        <td align="right" class="navi_link" style="width:105px">输出格式</td>
        <td>
        <asp:DropDownList ID="isDiv" runat="server" Width="180px">
            <asp:ListItem Value="">不指定</asp:ListItem>
            <asp:ListItem Value="true">DIV格式(推荐)</asp:ListItem>
            <asp:ListItem Value="false">Table格式</asp:ListItem>
        </asp:DropDownList>
        </td>
       </tr>
       <tr class="TR_BG_list">
        <td align="right" class="navi_link" style="width:105px">标题显示字数</td>
        <td>
           <asp:TextBox ID="titleNumber" Width="50px" runat="server" title="中文占2个字符"></asp:TextBox> 每行显示数 <asp:TextBox ID="Cols" Width="50px" runat="server" title="如果输出格式为div格式，请在CSS里控制一行的<li>属性"></asp:TextBox>  点击大于 <asp:TextBox ID="Click" Width="50px" runat="server"></asp:TextBox>  显示多少天内信息 <asp:TextBox ID="DateNum" Width="50px" runat="server"></asp:TextBox>
        </td>
       </tr>
       <tr class="TR_BG_list">
        <td align="right" class="navi_link" style="width:105px">排列类型</td>
        <td>
        <asp:DropDownList ID="OrderBy" runat="server" Width="100px">
            <asp:ListItem Value="">不指定</asp:ListItem>
            <asp:ListItem Value="id">自动编号</asp:ListItem>
            <asp:ListItem Value="CreatTime">创建日期</asp:ListItem>
            <asp:ListItem Value="click">点击</asp:ListItem>
            <asp:ListItem Value="orderid">权重</asp:ListItem>
        </asp:DropDownList>
        
        排列方式 
        <asp:DropDownList ID="Desc" runat="server" Width="100px">
            <asp:ListItem Value="">不指定</asp:ListItem>
            <asp:ListItem Value="desc">desc(降序)</asp:ListItem>
            <asp:ListItem Value="asc">asc(升序)</asp:ListItem>
        </asp:DropDownList>
        </td>
       </tr>
       <tr class="TR_BG_list">
        <td align="right" class="navi_link" style="width:105px">调用图片</td>
        <td>
        <asp:DropDownList ID="isPic" runat="server" Width="100px">
            <asp:ListItem Value="">不限制</asp:ListItem>
            <asp:ListItem Value="true">是</asp:ListItem>
            <asp:ListItem Value="false">否</asp:ListItem>
        </asp:DropDownList>
        
        <asp:DropDownList ID="Navi" runat="server" Width="120px" onchange="showNa(this.value);">
            <asp:ListItem Value="">是否加导航</asp:ListItem>
            <asp:ListItem Value="1">数字导航(1,2,3...)</asp:ListItem>
            <asp:ListItem Value="2">字母导航(A,B,C...)</asp:ListItem>
            <asp:ListItem Value="3">字母导航(a,b,c...)</asp:ListItem>
        </asp:DropDownList>
         <span id="TrNaviCSS" style="display:none;"> 导航CSS <asp:TextBox ID="NaviCSS" title="如果为空，可以在CSS里控制<dd>属性" Width="50px" runat="server"></asp:TextBox></span>
        </td>
       </tr>
      <tr class="TR_BG_list" id="TrPageID">
        <td align="right" class="navi_link" style="width:105px;"><span id="spanPageID"></span>分页样式</td>
        <td align="left" class="navi_link"><asp:TextBox ID="PageID" runat="server" CssClass="form" Width="120px"></asp:TextBox>
          &nbsp;
          <input class="form" type="button" value="选择分页样式"  onclick="javascript:show_channel('PageID',document.getElementById('spanPageID'),'选择分页样式',410,200);" /></td>
      </tr>
       
      <tr class="TR_BG_list">
        <td align="right" class="navi_link" style="width:105px">行参数控制</td>
        <td align="left" class="navi_link">
         奇数行背景CSS：<asp:TextBox ID="css1" Width="50" CssClass="form" runat="server"></asp:TextBox>&nbsp;偶数行背景CSS：<asp:TextBox ID="css2" CssClass="form" Width="50" runat="server"></asp:TextBox>
         <span class="reshow">对DIV+CSS无效</span>
        </td>
      </tr>
      
          <tr class="TR_BG_list">
            <td align="right" class="navi_link" style="width:105px">分行参数控制</td>
            <td align="left" class="navi_link">
                <asp:DropDownList ID="brTF" runat="server" CssClass="form" Width="200px" onchange="javascript:selectTF(this.value);">
                <asp:ListItem Value="false">显示分行效果</asp:ListItem>
                <asp:ListItem Value="true">是</asp:ListItem>
                <asp:ListItem Value="false">否</asp:ListItem>
              </asp:DropDownList>
             </td>
          </tr>
          
          <tr class="TR_BG_list" id="divbrtf" style="display:none;">
            <td align="right" class="navi_link" style="width:105px">定义分行参数</td>
            <td align="left" class="navi_link">
                <asp:TextBox ID="bfstr" Width="80%" CssClass="form" Text="0|5|CSS" runat="server"></asp:TextBox> 每行排列一个起作用<br />
                <span class="reshow">
                格式：0|5|css,第一个参数表示使用样式,第2个表示多少信息使用此设置,第3个参数表示具体参数<br />
                0表示使用CSS样式，如：0|5|tableCSS <br />
                1表示使用使用图片，如：1|5|/templet/br.gif <br />
                2表示使用使用文字，如：2|5|----------------
                </span>
             </td>
          </tr>
          <tr class="TR_BG_list">
            <td align="right" class="navi_link"></td>
            <td align="left" class="navi_link">&nbsp;<input class="form" type="button" value=" 确 定 "  onclick="javascript:ReturnDivValue();" />&nbsp;<input class="form" type="button" value=" 关 闭 "  onclick="javascript:CloseDiv();" /></td>
          </tr>
     </table>
    </div>
 </form>
</body>
</html>
<script language="javascript" type="text/javascript">
function showNa(obj)
{
    if(obj!="")
    {
        document.getElementById("TrNaviCSS").style.display="";
    }
    else
    {
        document.getElementById("TrNaviCSS").style.display="none";
    }
}
function selectTF(type)
{
    if(type=="false")
        { document.getElementById("divbrtf").style.display="none";  }
    else
        { document.getElementById("divbrtf").style.display=""; }
}
function showSty(obj)
{
    if(obj=="1")
    {
        document.getElementById("TrstContent").style.display="";
        document.getElementById("TrStyleID").style.display="none";
    }
    else
    {
        document.getElementById("TrstContent").style.display="none";
        document.getElementById("TrStyleID").style.display="";
    }
}
function ReturnDivValue()
{
    var CheckStr=true;
    if(document.ListLabel.Click.value!='')
    {
        if(isNaN(document.ListLabel.Click.value))
        {
            alert('点击次数只能为正整数');return false;
        }
    }
    if(document.ListLabel.DateNum.value!='')
    {
        if(isNaN(document.ListLabel.DateNum.value))
        {
            alert('显示多少天只能为正整数');return false;
        }
    }
    if(document.ListLabel.Cols.value!='')
    {
        if(isNaN(document.ListLabel.Cols.value))
        {
            alert('每行显示条数只能为正整数');return false;
        }
    }
    if(document.ListLabel.titleNumber.value!='')
    {
        if(isNaN(document.ListLabel.titleNumber.value))
        {
            alert('标题显示字数只能为正整数');return false;
        }
   }
    var temproot = "";
    var rvalue="[NT:Loop,NT:LabelType=ChannelClassList";
    
    if(document.ListLabel.StyleID.value=="0")
        { temproot = "[#NT:StyleID=" + document.ListLabel.gstyleID.value+"]"; }
    else
        { 
            //var oEditor = FCKeditorAPI.GetInstance("UserDefined");
            temproot = document.getElementById("UserDefined").value;
        }
    rvalue += ",NT:Type=" + document.ListLabel.Type.value;
    if(document.ListLabel.Cols.value!=""){ rvalue += ",NT:Cols=" + document.ListLabel.Cols.value; }
    if(document.ListLabel.Desc.value!=""){ rvalue += ",NT:Desc=" + document.ListLabel.Desc.value; }
    if(document.ListLabel.OrderBy.value!=""){ rvalue += ",NT:OrderBy=" + document.ListLabel.OrderBy.value; }
    if(document.ListLabel.isDiv.value!=""){ rvalue += ",NT:isDiv=" + document.ListLabel.isDiv.value; }
    if(document.ListLabel.isPic.value!=""){ rvalue += ",NT:isPic=" + document.ListLabel.isPic.value; }
    if(document.ListLabel.titleNumber.value!=""){ rvalue += ",NT:TitleNumer=" + document.ListLabel.titleNumber.value; }
    if(document.ListLabel.Click.value!=""){ rvalue += ",NT:ClickNumber=" + document.ListLabel.Click.value; }
    if(document.ListLabel.DateNum.value!=""){ rvalue += ",NT:ShowDateNumer=" + document.ListLabel.DateNum.value; }
    if(document.ListLabel.Navi.value!="")
    { 
        rvalue += ",NT:ShowNavi=" + document.ListLabel.Navi.value; 
        if(document.ListLabel.NaviCSS.value!="")
        { 
        rvalue += ",NT:NaviCSS=" + document.ListLabel.NaviCSS.value; 
        }
    
    }
    if(document.ListLabel.css1.value!=""&&document.ListLabel.css2.value!=""){ rvalue += ",NT:ColbgCSS=" + document.ListLabel.css1.value+"|"+document.ListLabel.css2.value; }
    if(document.ListLabel.PageID.value!=""){ rvalue += "," + document.ListLabel.PageID.value; } 
    if(document.ListLabel.brTF.value=="true")
    {
        rvalue += ",NT:bfStr=" + document.ListLabel.bfstr.value; 
    }
    rvalue += "]";
    rvalue += temproot;
    rvalue += "[/NT:Loop]";
    parent.getValue(rvalue);
}

function CloseDiv()
{
    parent.document.getElementById("LabelDivid").style.display="none";
}

function getValue(value)
{
   document.all.UserDefined.focus();
   var tarobj = document.selection.createRange();
   tarobj.text = value;
//    
//    var oEditor = FCKeditorAPI.GetInstance("UserDefined");
//    if (oEditor.EditMode==FCK_EDITMODE_WYSIWYG)
//    {
//       oEditor.InsertHtml(value);
//    }else
//    {
//        return false;
//    }
} 
</script>